<?php

namespace app\validate;

use think\Validate;

class Member extends Validate
{
    //验证规则
    protected $rule = [];

    // select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'require|array')
            ->append('param.filter.type_id', 'require')
            ->append('param.filter.type', 'require');
    }

    // create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require|array')
            ->append('data.users', 'require|array')
            ->append('data.type_id', 'require|integer')
            ->append('data.type', 'require')
            ->append('data.role', 'require');
    }

    // update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require|array')
            ->append('data.user_id', 'require|integer')
            ->append('data.type_id', 'require|integer')
            ->append('data.type', 'require')
            ->append('data.role', 'require');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require|array');
    }
}
